extends Label
var initial_y: float = 0  # Store the player's initial Y position
var score: float = 0  # Track the height gained
var has_reached_bees=false
@export var player: CharacterBody2D  # Reference to the player
@export var currentScore:Label
func _ready():
	if player != null:
		initial_y = player.global_position.y  # Set the initial Y position
		self.text = "Score: " + str(score)  # Initialize score display

func _process(delta):
	if player == null:
		return  # Exit if player is not assigned
	# Calculate the height gained (negative Y means higher up in 2D space)
	var height_gained = initial_y - player.global_position.y
	currentScore.text = "Score: " + str(round(height_gained/10))  # Round score for readability
	if height_gained > score:  # Update the score only if the player has gone higher
		score = height_gained
		self.text = "high Score: " + str(round(score/10))  # Round score for readability
func resetHighScore():
	score =0
	self.text = "Score: " + str(score)


func _on_pause_menu_score_reset():
	resetHighScore()
	player.position= Vector2(0,-550)
